package org.wmq.shopmanager.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wmq.commonutil.result.Result;
import org.wmq.shopmanager.service.OrderService;
import org.wmq.shopmanager.service.OrderStatisticService;
import org.wmq.shopmodel.DTO.product.OrderStatisticQueryDTO;
import org.wmq.shopmodel.VO.product.OrderStatisticVO;

import java.time.LocalDate;

@RestController
@RequestMapping("/admin/product/order")
@RequiredArgsConstructor
public class OrderController {
    private final OrderService orderService;
    private final OrderStatisticService orderStatisticService;

    @GetMapping("/getOrderStatisticData")
    public Result<OrderStatisticVO> getOrderStatisticData(@ModelAttribute OrderStatisticQueryDTO orderstatisticQueryDTO) {
        return Result.success(orderStatisticService.getTotalAmountByDate(orderstatisticQueryDTO));
    }
}
